package 华南理工大学;

import com.gargoylesoftware.htmlunit.WebClient;
import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;

import java.io.IOException;
import java.net.URL;
import java.util.HashMap;

public class HNu {
    public static void main(String[] args) throws IOException {

        String Url = "https://yanzhao.scut.edu.cn/open/TutorList.aspx";
        Page1(Url);
        Page2(Url);
        Page3(Url);
        Page4(Url);

    }

    public static String Page1(String Url) throws IOException {
//        Jsoup.parse()

        Connection connect = Jsoup.connect(Url);
        HashMap<String, String> header = new HashMap<>();
        header.put("authority", "yanzhao.scut.edu.cn");
        header.put("method", "POST");
        header.put("path", "/open/TutorList.aspx");
        header.put("scheme", "https");
        header.put("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7");
        header.put("accept-encoding", "gzip, deflate, br");
        header.put("accept-language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6");
        header.put("content-length", "12768");
        header.put("cache-control", "no-cache");
        header.put("content-type", "application/x-www-form-urlencoded; charset=UTF-8");
        header.put("cookie", "DropDownListNd=2023; ASP.NET_SessionId=l2vqovddh3qqgpsbfg1ux2du; ZS_XSBH=105; ZS_ZY=080800");
        header.put("referer", "https://cn.bing.com/");
        header.put("sec-ch-ua", "\"Chromium\";v=\"112\", \"Microsoft Edge\";v=\"112\", \"Not:A-Brand\";v=\"99\"");
        header.put("sec-ch-ua-mobile", "?0");
        header.put("sec-ch-ua-platform", "\"Windows\"");
        header.put("sec-fetch-dest", "document");
        header.put("sec-fetch-mode", "navigate");
        header.put("sec-fetch-site", "cross-site");
        header.put("sec-fetch-user", "?1");
        header.put("upgrade-insecure-requests", "1");
        header.put("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.48");
        Connection headers = connect.headers(header);
        Document document = headers.post();
        System.out.println(document.text());
        return document.text();
    }

    public static String Page2(String Url) throws IOException {

        Connection connect = Jsoup.connect(Url);
        HashMap<String, String> header = new HashMap<>();
        header.put("authority", "yanzhao.scut.edu.cn");
        header.put("method", "POST");
        header.put("path", "/open/TutorList.aspx");
        header.put("scheme", "https");
        header.put("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7");
        header.put("accept-encoding", "gzip, deflate, br");
        header.put("accept-language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6");
        header.put("content-length", "12700");
        header.put("cache-control", "no-cache");
        header.put("content-type", "application/x-www-form-urlencoded; charset=UTF-8");
        header.put("cookie", "DropDownListNd=2023; ASP.NET_SessionId=l2vqovddh3qqgpsbfg1ux2du; ZS_XSBH=105; ZS_ZY=080800");
        header.put("referer", "https://cn.bing.com/");
        header.put("sec-ch-ua", "\"Chromium\";v=\"112\", \"Microsoft Edge\";v=\"112\", \"Not:A-Brand\";v=\"99\"");
        header.put("sec-ch-ua-mobile", "?0");
        header.put("sec-ch-ua-platform", "\"Windows\"");
        header.put("sec-fetch-dest", "document");
        header.put("sec-fetch-mode", "navigate");
        header.put("sec-fetch-site", "cross-site");
        header.put("sec-fetch-user", "?1");
        header.put("upgrade-insecure-requests", "1");
        header.put("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.48");
        Connection headers = connect.headers(header);
        Document document = headers.post();
        System.out.println(document.text());
        return document.text();
    }

    public static String Page3(String Url) throws IOException {

        Connection connect = Jsoup.connect(Url);
        HashMap<String, String> header = new HashMap<>();
        header.put("authority", "yanzhao.scut.edu.cn");
        header.put("method", "POST");
        header.put("path", "/open/TutorList.aspx");
        header.put("scheme", "https");
        header.put("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7");
        header.put("accept-encoding", "gzip, deflate, br");
        header.put("accept-language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6");
        header.put("cache-control", "max-age=0");
        header.put("cookie", "DropDownListNd=2023; ASP.NET_SessionId=l2vqovddh3qqgpsbfg1ux2du; ZS_XSBH=105; ZS_ZY=080800");
        header.put("dnt", "1");
        header.put("referer", "https://cn.bing.com/");
        header.put("sec-ch-ua", "\"Chromium\";v=\"112\", \"Microsoft Edge\";v=\"112\", \"Not:A-Brand\";v=\"99\"");
        header.put("sec-ch-ua-mobile", "?0");
        header.put("sec-ch-ua-platform", "\"Windows\"");
        header.put("sec-fetch-dest", "document");
        header.put("sec-fetch-mode", "navigate");
        header.put("sec-fetch-site", "cross-site");
        header.put("sec-fetch-user", "?1");
        header.put("upgrade-insecure-requests", "1");
        header.put("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.48");
        Connection headers = connect.headers(header);
        Document document = headers.post();
        System.out.println(document.text());
        return document.text();
    }

    public static String Page4(String Url) throws IOException {

        Connection connect = Jsoup.connect(Url);
        HashMap<String, String> header = new HashMap<>();
        header.put("authority", "yanzhao.scut.edu.cn");
        header.put("method", "POST");
        header.put("path", "/open/TutorList.aspx");
        header.put("scheme", "https");
        header.put("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7");
        header.put("accept-encoding", "gzip, deflate, br");
        header.put("accept-language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6");
        header.put("content-length", "7906");
        header.put("cache-control", "no-cache");
        header.put("content-type", "application/x-www-form-urlencoded; charset=UTF-8");
        header.put("cookie", "DropDownListNd=2023; ASP.NET_SessionId=l2vqovddh3qqgpsbfg1ux2du; ZS_XSBH=105; ZS_ZY=080800");
        header.put("referer", "https://cn.bing.com/");
        header.put("sec-ch-ua", "\"Chromium\";v=\"112\", \"Microsoft Edge\";v=\"112\", \"Not:A-Brand\";v=\"99\"");
        header.put("sec-ch-ua-mobile", "?0");
        header.put("sec-ch-ua-platform", "\"Windows\"");
        header.put("sec-fetch-dest", "document");
        header.put("sec-fetch-mode", "navigate");
        header.put("sec-fetch-site", "cross-site");
        header.put("sec-fetch-user", "?1");
        header.put("upgrade-insecure-requests", "1");
        header.put("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.48");
        Connection headers = connect.headers(header);
        Document document = headers.post();
        System.out.println(document.text());
        return document.text();
    }
}
